package cn.edu.cuit.aumalls.controller;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.github.pagehelper.PageInfo;

import cn.edu.cuit.aumalls.constant.PageConstant;
import cn.edu.cuit.aumalls.entity.Goods;
import cn.edu.cuit.aumalls.entity.OrderDetailInfo;
import cn.edu.cuit.aumalls.entity.Orders;
import cn.edu.cuit.aumalls.service.FindOrderService;

@Controller
public class ShowMemberOrderController {
	
	@Autowired
	private FindOrderService findOrderService;
	
	List<List<OrderDetailInfo>> list;

	@RequestMapping("/PersonOrder")
	public String ShowAllOrder(Model model,
			@RequestParam(value = "pageNum", required = false, defaultValue = "1") int pageNum,
			@RequestParam(value = "orderUser",required = false, defaultValue = "") int orderUser) {
		PageInfo<Orders> orders = findOrderService.findUserOrder(pageNum, PageConstant.PAGE_SIZE, orderUser);
		
		
		
		List<OrderDetailInfo> detailList = findOrderService.findOrderAllGoods();
		System.out.println(detailList);
		
		model.addAttribute("orderlist", orders);
		model.addAttribute("OrderDetailList",detailList);
		
		return "personalOrder";
	}
}
